<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <body>
        <ui:composition template="/WEB-INF/templates/newMainCandidateTemplate.xhtml">
            <ui:define name="content">
                <h:outputStylesheet library="css" name="candidate/candidate.css"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_desktop.css" media="screen and (min-width:1025px) and (max-width:1600px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_desktop_wide.css" media="screen and (min-width : 1601px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_tablet.css" media="screen and (min-device-width : 768px) and (max-device-width : 1024px), screen and (max-width:1024px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="candidate/candidate_smartphone.css" media="screen and (min-device-width : 320px) and (max-device-width : 767px), screen and (max-width:767px)"></h:outputStylesheet>
                
                
                <h:form id="languageForm">
                    <p:growl id='languageGrowl'></p:growl>
                    <p:panel id="editLanguagePanel" styleClass="noPaddingTopTitle noMargin  noBorder marginTopBar" header="#{messages.Language}">
                            <p:selectOneMenu filter="true" filterMatchMode="contains" required="true" requiredMessage="#{messages.LanguageRequired}" converter="#{languageConverter}" id="editSelectLanguage"  value="#{newEditCandidateBean.collectorLanguageInfo.language}" effect="fade" label="#{messages.Language}" styleClass="candidateElementInput">  
                                <f:selectItem itemLabel="#{messages.Language}" itemValue="" />  
                                <f:selectItems value="#{userResourcesBean.languages}" var="language" itemLabel="#{languageBundle[language.idLanguage.toString()]}" itemValue="#{language}"/>  
                                <p:ajax update="editVideoUploader editButonAddLanguage buttonAddLanguageDialog"/>
                            </p:selectOneMenu>

                            <p:selectOneMenu styleClass="candidateElementInput"  required="true" requiredMessage="#{messages.LanguageLevelRequired}" converter="#{languageLevelConverter}" id="editSelectLanguageLevel"  value="#{newEditCandidateBean.collectorLanguageInfo.languageLevel}" effect="fade" label="#{messages.LanguageLevel}">  
                                <f:selectItem itemLabel="#{messages.LanguageLevel}" itemValue="" />  
                                <f:selectItems value="#{userResourcesBean.languageLevels}" var="languageLevel" itemLabel="#{languageLevelBundle[languageLevel.idLanguageLevel.toString()]}" itemValue="#{languageLevel}"/>  
                                <p:ajax update="editVideoUploader editButonAddLanguage buttonAddLanguageDialog"/>
                            </p:selectOneMenu>

                            <p:selectOneMenu styleClass="candidateElementInput"  required="true" requiredMessage="#{messages.WritingLevelRequired}" converter="#{languageLevelConverter}" id="editSelectWritingLevel"  value="#{newEditCandidateBean.collectorLanguageInfo.writingLevel}" effect="fade" label="#{messages.WritingLevel}">  
                                <f:selectItem itemLabel="#{messages.WritingLevel}" itemValue="" />  
                                <f:selectItems value="#{userResourcesBean.languageLevels}" var="languageLevel" itemLabel="#{languageLevelBundle[languageLevel.idLanguageLevel.toString()]}" itemValue="#{languageLevel}"/>  
                                <p:ajax update="editVideoUploader editButonAddLanguage buttonAddLanguageDialog"/>
                            </p:selectOneMenu>

                            <p:inputText styleClass="candidateElementInput"  id="editLanguageDescription" required="false" value="#{newEditCandidateBean.collectorLanguageInfo.description}" label="#{messages.EducationalDescription}">  
                                <f:validateLength maximum="100"></f:validateLength>
                                <p:ajax />
                            </p:inputText>  
                            <p:watermark for="editLanguageDescription" value="#{messages.EducationalDescription}" />

                            <p:fileUpload id="editVideoUploader" disabled="#{newEditCandidateBean.collectorLanguageInfo.language==null or newEditCandidateBean.collectorLanguageInfo.languageLevel==null or newEditCandidateBean.collectorLanguageInfo.writingLevel==null}" label="#{messages.VideoTag}" process="@parent" styleClass="uploadButton" auto="true" fileUploadListener="#{newEditCandidateBean.setVideoToCandidate}" invalidFileMessage="#{messages.InvalidVideoFormat}"
                                          oncomplete="redirect()"     sizeLimit="40000000" allowTypes="/(\.|\/)(mp4|MP4|avi|AVI|mov|MOV|flv|FLV|m4a|M4A|3gp|3GP|mpg|MPG|mpeg|MPEG|ogg|OGG|swf|SWF|wav|WAF|webm|WEBM|3g2@3G2|aac|AAC|)$/"></p:fileUpload>
                            <p:remoteCommand name="redirect" actionListener="#{newEditCandidateBean.reditectToLanguagePanel()}"/>
                            <p:commandButton rendered="#{newEditCandidateBean.collectorLanguageInfo.idCandidateLanguageInfo==null}" actionListener="#{newEditCandidateBean.saveLanguage()}" process="@parent" disabled="#{newEditCandidateBean.collectorLanguageInfo.language==null or newEditCandidateBean.collectorLanguageInfo.languageLevel==null or newEditCandidateBean.collectorLanguageInfo.writingLevel==null}" styleClass="grayBackgroundStrong" id="buttonAddLanguageDialog" value="#{messages.Add}" action="#{newEditCandidateBean.reditectToLanguagePanel()}"></p:commandButton>
                            <p:commandButton rendered="#{newEditCandidateBean.collectorLanguageInfo.idCandidateLanguageInfo!=null}" actionListener="#{newEditCandidateBean.editLanguage()}" process="@parent" disabled="#{newEditCandidateBean.collectorLanguageInfo.language==null or newEditCandidateBean.collectorLanguageInfo.languageLevel==null or newEditCandidateBean.collectorLanguageInfo.writingLevel==null}" styleClass="grayBackgroundStrong" id="editButonAddLanguage" value="#{messages.Edit}" action="#{newEditCandidateBean.reditectToLanguagePanel()}"></p:commandButton>  
                            <p:commandButton process="@this" styleClass="marginBottom05em marginTop05em grayBackgroundStrong block" id="back_button" value="#{messages.Cancel}" action="#{newEditCandidateBean.cancelReditectLanguagePanel()}"></p:commandButton>
                        </p:panel>
                </h:form>                
            </ui:define>
        </ui:composition>
         
    </body>
</html>
